/*
 * door_control_dll_declarations.h
 *
 *  Created on: 17.12.2012
 *      Author: aska
 */

#ifndef DOOR_CONTROL_DLL_DECLARATIONS_H_
#define DOOR_CONTROL_DLL_DECLARATIONS_H_
#include <windows.h>
#include <stdio.h>
using namespace std;
	typedef int  (__stdcall *t_door_control_init)(void);
	typedef int  (__stdcall *t_door_control_finish)(void);
	typedef int  (__stdcall *t_door_control_dev_if_mode)(int mode);
	typedef int  (__stdcall *t_door_control_ser_open)(void);
	typedef int  (__stdcall *t_door_control_dev_open)(void);
	typedef int  (__stdcall *t_door_control_ft_get_driver_version)(unsigned int* ft_drv_ver);
	typedef int  (__stdcall *t_door_control_ft_get_library_version)(unsigned int* ft_lib_ver);
	typedef int  (__stdcall *t_door_control_ser_set_name)(const char *s);
	typedef int  (__stdcall *t_door_control_ser_set_num)(int port_no);
	typedef int  (__stdcall *t_door_control_ser_set_baud)(int baud);
	typedef int  (__stdcall *t_door_control_ser_get_baud)(void);
	typedef int  (__stdcall *t_door_control_ser_read_buf)(char * buf, int * n_recv, int size);
	typedef int  (__stdcall *t_door_control_set_brd_ver)(char board_version);
	typedef int  (__stdcall *t_door_control_get_brd_ver)(char * board_version);
	typedef int  (__stdcall *t_door_control_set_ser_no)(const char *ser_no);
	typedef int  (__stdcall *t_door_control_get_ser_no)(char *ser_no, int buf_len);
	typedef int  (__stdcall *t_door_control_get_fwv)(char *fwv_str, int buf_len);
	typedef int  (__stdcall *t_door_control_leds_set)(int led_No, int led_state);
	typedef int  (__stdcall *t_door_control_lock_set)(int state);
	typedef int  (__stdcall *t_door_control_inps_get)(void);
	typedef int  (__stdcall *t_door_control_modem_reset)(void);
	typedef int  (__stdcall *t_door_control_d2xx_dll_open)(void);
	typedef int  (__stdcall *t_door_control_ser_close)(void);
	typedef int  (__stdcall *t_send_ping)(char * ip_addr);
	typedef int  (__stdcall *t_ping_start)(void);
	typedef int  (__stdcall *t_ping_stop)(void);
	typedef int  (__stdcall *t_ping_addr_add)(char * ip_addr);

	class door_control_lib{
	public:
		door_control_lib(void);
		HMODULE h_ser_port_dll;
		int door_control_dll_load(void);
		int dll_free(void);
		t_door_control_init				door_control_init;
		t_door_control_finish			door_control_finish;
		t_door_control_dev_if_mode		door_control_dev_if_mode;
		t_door_control_ser_open			door_control_ser_open;
		t_door_control_dev_open			door_control_dev_open;
		t_door_control_ft_get_driver_version	door_control_ft_get_driver_version;
		t_door_control_ft_get_library_version	door_control_ft_get_library_version;
		t_door_control_ser_set_name		door_control_ser_set_name;
		t_door_control_ser_set_num		door_control_ser_set_num;
		t_door_control_ser_set_baud		door_control_ser_set_baud;
		t_door_control_ser_get_baud		door_control_ser_get_baud;
		t_door_control_ser_read_buf		door_control_ser_read_buf;
		t_door_control_set_brd_ver		door_control_set_brd_ver;
		t_door_control_get_brd_ver		door_control_get_brd_ver;
		t_door_control_set_ser_no		door_control_set_ser_no;
		t_door_control_get_ser_no		door_control_get_ser_no;
		t_door_control_get_fwv			door_control_get_fwv;
		t_door_control_leds_set			door_control_leds_set;
		t_door_control_lock_set			door_control_lock_set;
		t_door_control_inps_get			door_control_inps_get;
		t_door_control_modem_reset		door_control_modem_reset;
		t_door_control_d2xx_dll_open	door_control_d2xx_dll_open;
		t_door_control_ser_close		door_control_ser_close;
		t_send_ping						send_ping;
		t_ping_start					ping_start;
		t_ping_stop						ping_stop;
		t_ping_addr_add					ping_addr_add;
	};

#endif /* DOOR_CONTROL_DLL_DECLARATIONS_H_ */
